import picker from '@ohos.file.picker';
import { BusinessError } from '@ohos.base';

export default {

  /**
   * 选择照片
   * @param photoSelectOptions
   * @returns
   */
  select(photoSelectOptions:picker.PhotoSelectOptions=new picker.PhotoSelectOptions()){
    let uris: Array<string> = [];
    const photoViewPicker = new picker.PhotoViewPicker();
    return new Promise((resolve, reject) => {
      photoViewPicker.select(photoSelectOptions).then((photoSelectResult: picker.PhotoSelectResult) => {
        uris = photoSelectResult.photoUris;
        resolve(uris);
      }).catch((err: BusinessError) => {
        reject(err);
      })
    })
  }





}